home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xmcd-1.4 / libdi.d / os_cdsim.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-10  |  3.3 KB  |  110 lines

  1. /*
  2.  *   libdi - CD Audio Player Device Interface Library
  3.  *
  4.  *   Copyright (C) 1995  Ti Kan
  5.  *   E-mail: ti@amb.org
  6.  *
  7.  *   This program is free software; you can redistribute it and/or modify
  8.  *   it under the terms of the GNU General Public License as published by
  9.  *   the Free Software Foundation; either version 2 of the License, or
  10.  *   (at your option) any later version.
  11.  *
  12.  *   This program is distributed in the hope that it will be useful,
  13.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  *   GNU General Public License for more details.
  16.  *
  17.  *   You should have received a copy of the GNU General Public License
  18.  *   along with this program; if not, write to the Free Software
  19.  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  */
  22. #ifndef __OS_CDSIM_H__
  23. #define __OS_CDSIM_H__
  24.  
  25. #if defined(DI_SCSIPT) && defined(DEMO_ONLY)
  26.  
  27. #ifndef LINT
  28. static char *_os_cdsim_h_ident_ = "@(#)os_cdsim.h    5.4 94/12/28";
  29. #endif
  30.  
  31.  
  32. #define CDSIM_MAGIC    0x584d4344    /* Magic number */
  33. #define MAX_DATALEN    1000        /* Max I/O data length */
  34.  
  35. /* Return status codes */
  36. #define CDSIM_COMPOK    0        /* Command completed OK */
  37. #define CDSIM_COMPERR    1        /* Command completed with error */
  38. #define CDSIM_NOTSUPP    2        /* Command not supported */
  39. #define CDSIM_PARMERR    3        /* Command parameter error */
  40. #define CDSIM_PKTERR    4        /* Command packet error */
  41.  
  42.  
  43. /* CD simulator IPC packet structure (1024 bytes in size) */
  44. typedef struct simpkt {
  45.     word32_t    magic;        /* Magic number */
  46.  
  47.     byte_t        pktid;        /* Packet id */
  48.     byte_t        retcode;    /* Return code */
  49.     byte_t        dir;        /* Data direction: READ_OP/WRITE_OP */
  50.     byte_t        cdbsz;        /* CDB size */
  51.  
  52.     word32_t    len;        /* Data length in bytes */
  53.  
  54.     byte_t        cdb[12];    /* CDB data */
  55.  
  56.     byte_t        data[MAX_DATALEN];
  57.                     /* I/O Data */
  58. } simpkt_t;
  59.  
  60.  
  61. #define CDSIM_NODISC    0x00        /* CD simulator no disc */
  62. #define CDSIM_STOPPED    0x01        /* CD simulator stopped */
  63. #define CDSIM_PAUSED    0x02        /* CD simulator paused */
  64. #define CDSIM_PLAYING    0x03        /* CD simulator playing audio */
  65.  
  66. #define CDSIM_NTRKS    10        /* Number of tracks on simulated CD */
  67. #define CDSIM_NIDXS    4        /* Number of index/track on sim CD */
  68. #define CDSIM_TRKLEN    4500        /* Length of each simulated track */
  69. #define CDSIM_IDXLEN    1125        /* Length of each simulated track */
  70.  
  71. /* CD simulator internal status structures */
  72.  
  73. typedef struct trkstat {
  74.     word32_t    addr;        /* Starting absolute addr of track */
  75.     byte_t        nidxs;        /* Number of indices */
  76.     byte_t        rsvd[3];    /* Reserved */
  77.     word32_t    iaddr[CDSIM_NIDXS];
  78.                     /* Index absolute addresses */
  79. } trkstat_t;
  80.  
  81. typedef struct simstat {
  82.     byte_t        status;        /* Current mode status flag */
  83.     byte_t        ntrks;        /* Number of tracks */
  84.     byte_t        trkno;        /* Current track */
  85.     byte_t        idxno;        /* Current index */
  86.  
  87.     word32_t    absaddr;    /* Current absolute address */
  88.     word32_t    reladdr;    /* Current relative address */
  89.     trkstat_t    trk[MAXTRACK];    /* Per-track information */
  90.     word32_t    startaddr;    /* Start play address */
  91.     word32_t    endaddr;    /* End play address */
  92.  
  93.     bool_t        caddylock;    /* Caddy locked */
  94. } simstat_t;
  95.  
  96.  
  97. #define CDSIM_PKTSZ    sizeof(simpkt_t)
  98. #define CDSIM_INQSZ    sizeof(inquiry_data_t)
  99.  
  100.  
  101. /* Public function prototypes */
  102. extern bool_t    cdsim_sendpkt(char *, int, simpkt_t *);
  103. extern bool_t    cdsim_getpkt(char *, int, simpkt_t *);
  104. extern void    cdsim_main(void);
  105.  
  106. #endif    /* DI_SCSIPT DEMO_ONLY */
  107.  
  108. #endif    /* __OS_CDSIM_H__ */
  109.  
  110.